package com.corpgovernment.permission.mapper;

import com.corpgovernment.organization.common.mybatis.TkMapper;
import com.corpgovernment.permission.entity.db.MbPermission;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * @author wangyujue
 */
@Repository
public interface PermissionMapper extends TkMapper<MbPermission> {

    /**
     * 根据UID与orgID查找所有权限
     */
    List<MbPermission> list(@Param("uId") String uId, @Param("roleOrgId") String roleOrgId, @Param("userOrgId") String userOrgId, @Param("isBackground") boolean isBackground, @Param("onlyConfigurable") Boolean onlyConfigurable);
    /**
     * 根据uid查询所有权限
     */
    List<MbPermission> listByBackground(@Param("isBackground") boolean isBackground);

    /**
     * 根据uid和前后台用户查询所有权限
     */
    List<MbPermission> listByUid(@Param("uId") String uId, @Param("roleOrgId") String roleOrgId);

    List<MbPermission> listBgByConfigurable(@Param("configurable") Boolean loadConfigurable);

    List<MbPermission> listByUidAndOrgId(@Param("uId") String uId, @Param("orgId") String orgId);

    List<MbPermission> listByUidAndOrgIdNew(@Param("uId") String uId, @Param("orgId") String orgId);
    /**
     * 获取所有的菜单
     */
    List<MbPermission> listAllMenu();


    void insertItem(MbPermission mbPermission);
    /**
     * 批量更新
     */
    void updateBatch(List<MbPermission> list);

    int delete(List<MbPermission> list);
    // /**
    //  * 通过主键查询
    //  */
    // MbPermission queryById(Long id);

    // List<MbPermission> queryByParentId(@Param("parentId") Long parentId);
}
